home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 4.8 KB | 147 lines | [TEXT/MPS ] |
- /*
- File: Math64.idl
-
- Contains: 64-bit integer math Interfaces.
-
- Version: Technology: System 8
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __MATH64_IDL__
- #define __MATH64_IDL__
-
- #include <somobj.idl>
- #include <somcls.idl>
-
- #ifndef __TYPES_IDL__
- #include <Types.idl>
- #endif
-
- #ifdef __SOMIDL__
-
- /*
- --------------------------------------------------------------------------------
- These routines are intended to provide C software support for
- 64 bit integer types. Their behavior should mimic anticipated
- 64 bit hardware. This implementation should replace use of the
- "wide" type found in PowerPC.
-
- The following routines are available for performing math on 64-bit integers:
-
- S64Max
- Returns the largest representable SInt64.
- S64Min
- Returns the smallest (i.e. most negative) SInt64. Note: the negative
- (absolute value) of this number is not representable in an SInt64.
- That means that S64Negate(S64Min) is not representable (in fact,
- it returns S64Min).
- S64Add
- Adds two integers, producing an integer result. If an overflow
- occurs the result is congruent mod (2^64) as if the operands and
- result were unsigned. No overflow is signaled.
-
- S64Subtract
- Subtracts two integers, producing an integer result. If an overflow
- occurs the result is congruent mod (2^64) as if the operands and
- result were unsigned. No overflow is signaled.
-
- S64Negate
- Returns the additive inverse of a signed number (i.e. it returns
- 0 - the number). S64Negate (S64Min) is not representable (in fact,
- it returns S64Min).
-
- S64Absolute
- Returns the absolute value of the number (i.e. the number if
- it is positive, or 0 - the number if it is negative).
- See S64Negate above.
-
- S64Multiply
- Multiplies two signed numbers, producing a signed result. Overflow
- is ignored and the low-order part of the product is returned. The
- sign of the result is not guaranteed to be correct if the magnitude
- of the product is not representable.
- S64Divide
- Divides dividend by divisor, returning the quotient. The remainder
- is returned in *remainder if remainder (the pointer) is non-NULL.
- The sign of the remainder is the same as the sign of the dividend
- (i.e. it takes the absolute values of the operands, does the division,
- then fixes the sign of the quotient and remainder). If the divisor
- is zero, then S64Max() will be returned (or S64Min() if the dividend
- is negative), and the remainder will be the dividend; no error is
- reported.
-
- S64Set
- Given an SInt32, returns an SInt64 with the same value. Use this
- routine instead of coding 64-bit constants (at least when the
- constant will fit in an SInt32).
-
- S64SetU
- Given a UInt32, returns a SInt64 with the same value.
-
- S64Compare
- Given two signed numbers, left and right, returns an
- SInt32 that compares with zero the same way left compares with
- right. If you wanted to perform a comparison on 64-bit integers
- of the form:
- operand_1 <operation> operand_2
- then you could use an expression of the form:
- xxxS64Compare(operand_1,operand_2) <operation> 0
- to test for the same condition.
-
- CAUTION: DO NOT depend on the exact value returned by this routine.
- Only the sign (i.e. positive, zero, or negative) of the result is
- guaranteed.
-
- S64And, S64Or, S64Eor and S64Not
-
- Return Boolean (1 or 0) depending on the outcome of the logical
- operation.
-
- S64BitwiseAnd, S64BitwiseOr, S64BitwiseEor and S64BitwiseNot
-
- Return the Bitwise result.
-
- S64ShiftRight and S64ShiftLeft
-
- The lower 7 bits of the shift argument determines the amount of
- shifting. S64ShiftRight is an arithmetic shift while U64ShiftRight
- is a logical shift.
-
- SInt64ToLongDouble
-
- Converts SInt64 to long double. Note all SInt64s fit exactly into
- long doubles, thus, the binary -> decimal conversion routines
- in fp.h can be used to achieve SInt64 -> long double -> decimal
- conversions.
-
- LongDoubleToSInt64
-
- Converts a long double to a SInt64. Any decimal string that fits
- into a SInt64 can be converted exactly into a long double, using the
- conversion routines found in fp.h. Then this routine can be used
- to complete the conversion to SInt64.
-
-
-
- The corresponding UInt64 routines are also included.
-
- --------------------------------------------------------------------------------
- */
- #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
- #if GENERATINGPOWERPC
- #endif
- #endif
-
- #endif /* __SOMIDL__ */
-
- #endif /* __MATH64_IDL__ */
-
-